package com.aspose.cells;

import java.util.ArrayList;

class zaqb {
   String a;
   boolean b;
   int c;
   int d = 7;
   ArrayList e = new ArrayList();
   ArrayList f = new ArrayList();
   static String[] g = new String[]{"style", "long"};
   boolean h;

   static int a(char[] var0, char var1, int var2) {
      ++var2;

      while(var2 < var0.length) {
         char var3 = var0[var2];
         if (var3 == var1) {
            return var2;
         }

         ++var2;
      }

      return var2;
   }

   static int b(char[] var0, char var1, int var2) {
      ++var2;

      while(var2 < var0.length) {
         char var3 = var0[var2];
         if (var3 != var1) {
            return var2;
         }

         ++var2;
      }

      return var2;
   }

   static int c(char[] var0, char var1, int var2) {
      ++var2;

      while(var2 < var0.length) {
         char var3 = var0[var2];
         if (var3 != var1 && var3 + 32 != var1) {
            return var2;
         }

         ++var2;
      }

      return var2;
   }

   static int a(char[] var0, int var1, boolean[] var2, boolean[] var3, int[] var4, int[] var5) {
      for(; var1 < var0.length; ++var1) {
         char var6 = var0[var1];
         switch(var6) {
         case '#':
            ++var5[0];
            break;
         case ',':
            var2[0] = true;
            break;
         case '.':
            var3[0] = true;
            return var1;
         case '0':
            ++var4[0];
            ++var5[0];
            break;
         default:
            return var1;
         }
      }

      return var1;
   }

   static int a(char[] var0, int var1, int[] var2, boolean[] var3) {
      for(; var1 < var0.length; ++var1) {
         char var4 = var0[var1];
         switch(var4) {
         case '#':
            ++var2[0];
            break;
         case '0':
            ++var2[0];
            var3[0] = false;
            break;
         default:
            return var1;
         }
      }

      return var1;
   }

   static int a(char[] var0, int var1, int[] var2) {
      while(var1 < var0.length) {
         char var3 = var0[var1];
         switch(var3) {
         case '#':
         case '0':
            ++var2[0];
         case '+':
         case '-':
            ++var1;
            break;
         default:
            return var1;
         }
      }

      return var1;
   }

   void a(String var1, int var2, String var3) {
      this.f = new ArrayList();
      this.a = var1;
      this.c = var2;
      char[] var4 = var3.toCharArray();
      zaqq var5 = null;
      int var6 = -1;
      String var7 = null;
      int var8 = 0;
      int var9 = 0;
      int var10 = 0;
      boolean var11 = false;
      boolean var12 = false;

      for(int var13 = 0; var13 < var4.length; ++var13) {
         char var14 = var4[var13];
         switch(var14) {
         case '"':
            var6 = a(var4, var14, var13);
            var5 = new zaqq(0, var3.substring(var13 + 1, var13 + 1 + (var6 - var13 - 1)));
            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            var13 = var6;
            break;
         case '#':
         case '0':
            boolean var25 = false;
            if (this.d == 7) {
               this.d = 1;
            }

            boolean[] var27 = new boolean[]{var11};
            boolean[] var18 = new boolean[]{var25};
            int[] var19 = new int[]{var9};
            int[] var20 = new int[]{var10};
            var6 = a(var4, var13, var27, var18, var19, var20);
            var11 = var27[0];
            var25 = var18[0];
            var9 = var19[0];
            var10 = var20[0];
            var5 = new zaqq(4, (String)null);
            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"min-integer-digits", zaqh.a(var9)}));
            if (var11) {
               com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"grouping", "true"}));
            }

            if (!var25) {
               var5.b.add(0, new String[]{"decimal-places", "0"});
            }

            var13 = var6 - 1;
            break;
         case '$':
         case '€':
         case '￡':
         case '￥':
            var5 = new zaqq(3, Character.toString(var14));
            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            this.d = 0;
            break;
         case '%':
            this.d = 6;
            var5 = new zaqq(0, "%");
            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
         case '*':
            break;
         case '.':
            if (this.d == 7) {
               this.d = 1;
            }

            if (this.d != 2 && this.d != 3) {
               int[] var21 = new int[]{var8};
               boolean[] var22 = new boolean[]{var12};
               var6 = a(var4, var13 + 1, var21, var22);
               var8 = var21[0];
               var12 = var22[0];
               if (var5 == null) {
                  var5 = new zaqq(4, (String)null);
                  com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
                  com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"min-integer-digits", "0"}));
               }

               com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"decimal-places", zaqh.a(var8)}));
               if (var12) {
                  com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"decimal-replacement", ""}));
               }

               var13 = var6 - 1;
               break;
            }

            var5 = new zaqq(0, ".");
            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            break;
         case '?':
            var6 = a(var4, '/', var13);
            if (var6 < var4.length) {
               this.d = 1;
               var5 = new zaqq(13, (String)null);
               com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"min-numerator-digits", zaqh.a(var6 - var13)}));
               var13 = var6;
               var6 = b(var4, '?', var6);
               com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"min-denominator-digits", zaqh.a(var6 - var13)}));
               com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
               var13 = var6 - 1;
            }
            break;
         case '@':
            if (this.d == 7) {
               this.d = 5;
            }

            var5 = new zaqq(1, (String)null);
            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            break;
         case 'A':
         case 'a':
            if (var13 == var4.length - 1 || var4[var13 + 1] != 'M' && var4[var13 + 1] != 'm') {
               var5 = new zaqq(0, Character.toString(var14));
               com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            } else {
               var5 = new zaqq(12, (String)null);
               com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
               var13 += 4;
            }
            break;
         case 'D':
         case 'd':
            var6 = c(var4, 'd', var13);
            this.d = 2;
            int var23 = var6 - var13;
            switch(var23) {
            case 4:
               var5 = new zaqq(15, (String)null);
               break;
            default:
               var5 = new zaqq(8, (String)null);
            }

            if (var6 - var13 >= 2) {
               com.aspose.cells.b.a.a.ze.a(var5.b, (Object)g);
            }

            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            var13 = var6 - 1;
            break;
         case 'E':
         case 'e':
            int var24;
            if (var5 == null) {
               var5 = new zaqq(0, Character.toString(var14));
               com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            } else {
               var5.a = 14;
               byte var16 = 0;
               int[] var17 = new int[]{var16};
               var6 = a(var4, var13 + 1, var17);
               var24 = var17[0];
               com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"min-exponent-digits", zaqh.a(var24)}));
            }

            if (var10 != var9) {
               for(var24 = 0; var24 < var5.b.size(); ++var24) {
                  String[] var26 = (String[])((String[])var5.b.get(var24));
                  if ("min-integer-digits".equals(var26[0])) {
                     var5.b.remove(var24);
                     com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"min-integer-digits", zaqh.a(var10)}));
                     break;
                  }
               }
            }

            var13 = var6 - 1;
            break;
         case 'H':
         case 'h':
            var6 = c(var4, 'h', var13);
            var5 = new zaqq(9, (String)null);
            if (this.d == 7) {
               this.d = 3;
            }

            if (var6 - var13 >= 2) {
               com.aspose.cells.b.a.a.ze.a(var5.b, (Object)g);
            }

            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            var13 = var6 - 1;
            break;
         case 'M':
         case 'm':
            var6 = c(var4, 'm', var13);
            if ((var6 >= var4.length || var4[var6] != ':') && (var13 == 0 || var4[var13 - 1] != ':') && this.d != 3) {
               this.d = 2;
               var5 = new zaqq(7, (String)null);
               switch(var6 - var13) {
               case 1:
                  break;
               case 2:
                  com.aspose.cells.b.a.a.ze.a(var5.b, (Object)g);
                  break;
               case 3:
                  com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"textual", "true"}));
                  break;
               case 4:
               default:
                  com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"textual", "true"}));
                  com.aspose.cells.b.a.a.ze.a(var5.b, (Object)g);
                  break;
               case 5:
                  com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"textual", "true"}));
               }

               com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            } else {
               if (this.d == 7) {
                  this.d = 3;
               }

               var5 = new zaqq(10, (String)null);
               if (var6 - var13 >= 2) {
                  com.aspose.cells.b.a.a.ze.a(var5.b, (Object)g);
               }

               com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            }

            var13 = var6 - 1;
            break;
         case 'S':
         case 's':
            var6 = c(var4, 's', var13);
            var5 = new zaqq(11, (String)null);
            if (this.d == 7) {
               this.d = 3;
            }

            if (var6 - var13 >= 2) {
               com.aspose.cells.b.a.a.ze.a(var5.b, (Object)g);
            }

            var13 = var6;
            if (var6 != var4.length && var4[var6] == '.') {
               var6 = b(var4, '0', var6);
               com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"decimal-places", zaqh.a(var6 - var13 - 1)}));
            }

            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            var13 = var6 - 1;
            break;
         case 'Y':
         case 'y':
            var6 = c(var4, 'y', var13);
            this.d = 2;
            var5 = new zaqq(6, (String)null);
            if (var6 - var13 > 2) {
               com.aspose.cells.b.a.a.ze.a(var5.b, (Object)g);
            }

            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            var13 = var6 - 1;
            break;
         case '[':
            var6 = a(var4, ']', var13);
            var7 = var3.substring(var13 + 1, var13 + 1 + (var6 - var13 - 1));
            if (var7.length() == 1 && (var7.charAt(0) == 'H' || var7.charAt(0) == 'h')) {
               com.aspose.cells.b.a.a.ze.a(this.e, (Object)(new String[]{"number:truncate-on-overflow", "false"}));
               var5 = new zaqq(9, (String)null);
               com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            } else if (var7.charAt(0) != '$' && zfx.a(var7.toLowerCase())) {
               Color var15 = Color.a(var7);
               if (!var15.isEmpty()) {
                  var5 = new zaqq(2, (String)null);
                  com.aspose.cells.b.a.a.ze.a(var5.b, (Object)(new String[]{"color", zaqh.b(var15)}));
                  com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
               }
            }

            var13 = var6;
            break;
         case '\\':
            ++var13;
            if (var13 < var3.length()) {
               var5 = new zaqq(0, "" + var3.charAt(var13));
               com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            }
            break;
         case '_':
            ++var13;
            if (var5 != null && var5.a == 0) {
               var5.c = var5.c + " ";
               break;
            }

            var5 = new zaqq(0, " ");
            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            break;
         default:
            if (var5 != null && var5.a == 0) {
               var5.c = var5.c + var14;
            } else {
               var5 = new zaqq(0, Character.toString(var14));
               com.aspose.cells.b.a.a.ze.a(this.f, (Object)var5);
            }
         }
      }

   }

   void a(int var1) {
      this.b = true;
      this.c = var1;
      this.a = "N" + var1;
   }

   void b(int var1) {
      this.h = true;
      zaqq var2 = null;
      String var3 = "condition";
      String var4 = "apply-style-name";
      switch(var1) {
      case 2:
         var2 = new zaqq(5, (String)null);
         com.aspose.cells.b.a.a.ze.a(var2.b, (Object)(new String[]{var3, "value()>=0"}));
         com.aspose.cells.b.a.a.ze.a(var2.b, (Object)(new String[]{var4, "N" + this.c + "P" + 0}));
         com.aspose.cells.b.a.a.ze.a(this.f, (Object)var2);
         break;
      case 3:
      case 4:
         var2 = new zaqq(5, (String)null);
         com.aspose.cells.b.a.a.ze.a(var2.b, (Object)(new String[]{var3, "value()>0"}));
         com.aspose.cells.b.a.a.ze.a(var2.b, (Object)(new String[]{var4, "N" + this.c + "P" + 0}));
         com.aspose.cells.b.a.a.ze.a(this.f, (Object)var2);
         var2 = new zaqq(5, (String)null);
         com.aspose.cells.b.a.a.ze.a(var2.b, (Object)(new String[]{var3, "value()<0"}));
         com.aspose.cells.b.a.a.ze.a(var2.b, (Object)(new String[]{var4, "N" + this.c + "P" + 1}));
         com.aspose.cells.b.a.a.ze.a(this.f, (Object)var2);
         if (var1 == 4) {
            var2 = new zaqq(5, (String)null);
            com.aspose.cells.b.a.a.ze.a(var2.b, (Object)(new String[]{var3, "value()=0"}));
            com.aspose.cells.b.a.a.ze.a(var2.b, (Object)(new String[]{var4, "N" + this.c + "P" + 2}));
            com.aspose.cells.b.a.a.ze.a(this.f, (Object)var2);
         }
      }

   }
}
